package ttk.muxiuesd.util;

public class ChunkPosition {
    int x;
    int y;

    public ChunkPosition() {
    }

    public ChunkPosition(int x, int y) {
        this.x = x;
        this.y = y;
    }

    /**重写：
     * 判断区块的坐标是否相等
     * */
    @Override
    public boolean equals(Object obj) throws RuntimeException{
        if (!(obj instanceof ChunkPosition)) {
            throw new RuntimeException("传入的形参不是ChunkPosition的实例！！！");
        }
        ChunkPosition cp = (ChunkPosition) obj;
        return this.getX() == cp.getX() && this.getY() == cp.getY();
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public String toString() {
        return "("+ getX() + "," + getY() +")";
    }
}
